import { ORDER_DATA } from './actionTypes'
import axios from 'axios';
import { CHANGEREADYSTATE } from 'component/ScrollView/scrollViewActionsType'

export const getOrderData = (page) => (dispatch) => {

    dispatch({
        type: CHANGEREADYSTATE,
        obj: false
    })

    axios({
        method: 'get',
        url: '/json/orders.json'
    }).then(rsp => {
        dispatch({
            type: CHANGEREADYSTATE,
            obj: false
        })

        dispatch({
            type: ORDER_DATA,
            currentPage: page,
            obj: rsp.data.data
        })
    })
}